﻿using Helpers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ShenMaPrint
{
    static class Program
    {
       static int indexer = 0;
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var th_RunMain = new Thread(new ThreadStart(RunMain));
            th_RunMain.IsBackground = true;
            th_RunMain.Start();
            Application.Run(new Form1());

        }
        public static void RunMain() {
          
            while (true) {
             
                Thread.Sleep(60000*60);
             
                    if (DateTime.Now.Hour % 6 == 0) {
                        Process.Start("ShenMaPrint.exe");
                        LogHelper.SaveLog("重新启动", LogHelper.LogType.RecDataState, "称重记录");
                        System.Environment.Exit(0);
                    }
                
                

               
            }
        }
    }
}
